using SharpArch.Data.NHibernate;
using System.Collections.Generic;
using NHibernate;
using NHibernate.Transform;
using GoldenBicycleCompany.Core;
using GoldenBicycleCompany.Core.QueryDtos;
using GoldenBicycleCompany.Core.RepositoryInterfaces;

namespace GoldenBicycleCompany.Data.Repositories
{
    public class LocationRepository : Repository<Location>, ILocationRepository
    {
        public IList<LocationDto> GetLocationSummaries() {
            ISession session = SharpArch.Data.NHibernate.NHibernateSession.Current;

            IQuery query = session.GetNamedQuery("GetLocationSummaries")
                .SetResultTransformer(Transformers.AliasToBean<LocationDto>());

            return query.List<LocationDto>();
        }
    }
}
